<?php

class Form_ContactForm extends Zend_Form {

    public function init() {
        $author = $this->createElement('text', 'name')
                        ->removeDecorator('DtDdWrapper')
                        ->removeDecorator('label')
                        ->removeDecorator('HtmlTag')
                        ->removeDecorator('Errors')
                        ->setRequired(TRUE)
                        ->addValidator('NotEmpty', true, array('messages' => array('isEmpty' => 'Please enter name')))
                        ->setAttribs(Array('class' => "rounded1"));

        $this->addElement($author);

        $email = $this->createElement('text', 'email')
                        ->removeDecorator('DtDdWrapper')
                        ->removeDecorator('label')
                        ->removeDecorator('HtmlTag')
                        ->removeDecorator('Errors')
                        ->setRequired(TRUE)
                        ->addValidator('NotEmpty', true, array('messages' => array('isEmpty' => 'Email address shouldnot be blank.')))
                        ->addValidator(new Zend_Validate_EmailAddress())
                        ->addFilters(array(
                            new Zend_Filter_StringTrim(),
                            new Zend_Filter_StringToLower()
                        ))
                        ->setAttribs(Array('class' => "rounded"));
        $email->getValidator('emailAddress')->setMessage("Email address is not valid.", Zend_Validate_EmailAddress::INVALID_FORMAT);
        $this->addElement($email);

        $subject = $this->createElement('text', 'subject')
                        ->removeDecorator('DtDdWrapper')
                        ->removeDecorator('label')
                        ->removeDecorator('HtmlTag')
                        ->removeDecorator('Errors')
                        ->setRequired(TRUE)
                        ->addFilters(array(
                            new Zend_Filter_StringTrim(),
                            new Zend_Filter_StringToLower()
                        ))
                        ->addValidator('NotEmpty', true, array('messages' => array('isEmpty' => 'Please enter subject.')))
                        ->setAttribs(Array('class' => "rounded"));
        $this->addElement($subject);

        $description = $this->createElement('textarea', 'message')
                        ->removeDecorator('DtDdWrapper')
                        ->removeDecorator('label')
                        ->removeDecorator('HtmlTag')
                        ->removeDecorator('Errors')
                        ->setRequired(TRUE)
                        ->setAttrib('cols', 42)
                        ->setAttrib('rows', 7)
                        ->addValidator('NotEmpty', true, array('messages' => array('isEmpty' => 'Please enter message.')))
                        ->setAttribs(Array('class' => "rounded"));
        $this->addElement($description);

        $submit = $this->createElement('submit', 'SEND')
                        ->removeDecorator('DtDdWrapper')
                        ->removeDecorator('label')
                        ->removeDecorator('HtmlTag')
                        ->setAttribs(Array('class' => "submit-btn rounded"));
        $this->addElement($submit);
    }

}